#define DEBUG
#include <cstdio>
#define MAXP 16
#define MAXC 10000

using namespace std;

unsigned long long min(unsigned long long a, unsigned long long b) {
  return a<b ? a : b;
}

int main() {
#ifdef DEBUG
  freopen("3020.in", "r", stdin);
  freopen("3020.out", "w", stdout);
#endif

  static const int prime[MAXP+1]={0, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53};
  static unsigned long long f[MAXP+1][MAXC+1];

  unsigned long long x, ans=1;
  int max=0;
  scanf("%llu", &x);
  f[0][1] = 1;
  for (int i=1; i<=MAXP; i++) {
    unsigned long long temp=1;
    for (int j=2; j<=MAXC && temp<=x; j++) {
      if (temp<=x/prime[i]+1 && temp*prime[i]<=x) {
	temp = temp*prime[i];
	for (int k=1; j*k<=MAXC && f[i-1][k]<=x/temp+1 && temp*f[i-1][k]<=x; k++) {
	  if (f[i-1][k]) {
	    f[i][j*k] = f[i][j*k] ? min(f[i][j*k], f[i-1][k]*temp) : f[i-1][k]*temp;
	    if (j*k>max) {
	      max = j*k;
	      ans = f[i][j*k];
	    }
	    if (j*k==max && ans>f[i][j*k]) {
	      ans=f[i][j*k];
	    }
	  }
	}
      } else {
	break;
      }
    }
  }
  
#ifdef DEBUG
  printf("%d\n", max);
#endif
  printf("%llu", ans);

  fclose(stdin);
  fclose(stdout);
  return 0;
}
